package com.agent.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.agent.exception.MyException;
import com.agent.model.TravelAgency;
import com.agent.service.ITravelAgencySer;

@Controller
@RequestMapping(value="/travelAgency",produces="text/html;charset=UTF-8")
public class TravelAgencyController  extends BaseController{

	@Autowired
	ITravelAgencySer travelAgencySer;
	
	/**
	 * 查看公海旅行社（未领取）
	 * @param model
	 * @param request
	 * @return
	 */
	@RequestMapping("/travelAgencyList")
	@ResponseBody
	public String findListTravelAgency(Model model, HttpServletRequest request){
		try {
			List<TravelAgency> resultList = travelAgencySer.findListTravelAgency();
			return super.ajaxReturnTool.success(resultList).toJson();
		} catch (MyException e) {
			return super.ajaxReturnTool.fail(e.getCode()).toJson();
		}
	}
}
